# 位运算
# 按位与
n = 0x8FA6002D
print("9 & 5 = %X" %(9 & 5))
print("-9 & 5 = %X" %(-9 & 5))
print("n & 0xFFFF = %X" %(n & 0xFFFF))

print()

# 按位或
n = 0x2D
print("9 | 5 = %X" %(9 | 5))
print("-9 | 5 = %X" %(-9 | 5))
print("n | 0xFFFF0000 = %X" %(n | 0xFFFF0000))

print()

# 按位异或
n = 0x0A07002D
print("9 ^ 5 = %X" %(9 ^ 5))
print("-9 ^ 5 = %X" %(-9 ^ 5))
print("n ^ 0xFFFF0000 = %X" %(n ^ 0xFFFF0000))

print()

# 按位取反
print("~9 = %X" %(~9))
print("~-9 = %X" %(~-9))

print()

# 左移运算
print("9 << 3 = %X" %(9 << 3))
print("(-9) << 3 = %X" %((-9) << 3))

print()

# 右移运算
print("9 >> 3 = %X" %(9 >> 3))
print("(-9) >> 3 = %X" %((-9) >> 3))

